<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta HTTP-EQUIV="pragma" CONTENT="no-cache">
    <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <meta HTTP-EQUIV="expires" CONTENT="0">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>基础桩编辑</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/font-awesome.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/ui.css" rel="stylesheet">
    <link href="css/layui.css" rel="stylesheet">
    <link href="css/control.css" rel="stylesheet">
    <style>
        #body {
            width: 100%;
            max-height: 100%;
            overflow-y: scroll;
            overflow-x: hidden;
        }

        .articleImg {
            /* width: 100%; */
            /* height: auto !important; */
            max-width: 100px;
        }

        th,
        td {
            text-align: center;
        }

        .textAreaBlock {
            margin-left: 130px;
            min-height: 36px;
        }

        .form_item_align_left {
            text-align: left;
        }

        .from_item_align_center {
            text-align: center;
        }

    </style>
</head>

<body class="gray-bg animated fadeInRight">
<div id="body">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">

                        <div id="content">

                            <fieldset style="margin-top: 20px">
                                <legend>帮助信息</legend>
                            </fieldset>

                            <div class="layui-form-item form_item_align_left">
                                <input type="hidden" id="helpId"/>
                                <div class="layui-inline">
                                    <label class="layui-form-label">桩身混凝土描述</label>
                                    <div class="layui-input-inline" style="width: 525px">
                                        <textarea id="description_pile_concrete_description" placeholder="请输入内容"
                                                  class="layui-textarea"></textarea>
                                    </div>
                                </div>


                                <div class="layui-inline">
                                    <label class="layui-form-label">持力层描述</label>
                                    <div class="layui-input-inline" style="width: 525px">
                                        <textarea id="bearing_layer_description" placeholder="请输入内容"
                                                  class="layui-textarea"></textarea>
                                    </div>
                                </div>

                                </div>
                            </div>

                        <div class="from_item_align_center">
                            <button id="editHelp" class="btn btn-info edit-help">提交</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/work/common.js"></script>
<script src="js/plugins/laydate/laydate.js"></script>
<script src="js/plugins/layer/layer.min.js"></script>
<script src="js/plugins/layer/layer.js"></script>
<script src="js/layui.js"></script>
<!-- 自定义js -->
<script src="js/content.js"></script>
<script src="js/pileEdit.js"></script>
<script>
    layui.use(['form'], function () {
    });
    var pileId = getStorage("pileId");
    $(document).ready(function () {
        initPileUpdate();
    });

    function initPileUpdate() {
        ajax({
            url: "pile/showHelp",
            type: "GET",
            // xhrFields: {
            //     withCredentials: true
            // },
            // crossDomain: true,
            data: {},
            timeout: 10000,
            contentType: "application/json;charset=utf-8",
            error: function (xhr, type) {
                layer.msg("服务器异常，请稍后重试！", {time: 2000})
            },
            successx: function (data) {
                if (data.success == true) {
                    console.log(data);
                    $("#description_pile_concrete_description").val(data.data.descriptionPileConcreteDescription);
                    $("#bearing_layer_description").val(data.data.bearingLayerDescription);
                    $("#helpId").val(data.data.id);
                } else {
                    layer.msg(data.message, {time: 1000})
                }
            }
        });

    }

    $("#editHelp").click(function () {
        var descriptionPileConcreteDescription = $("#description_pile_concrete_description").val();
        var bearingLayerDescription = $("#bearing_layer_description").val();
        var id = $("#helpId").val();
        var dataJson = {id:id,descriptionPileConcreteDescription:descriptionPileConcreteDescription,bearingLayerDescription:bearingLayerDescription};
        ajax({
            url: "pile/createHelp",
            type: "POST",
            dataType: 'json',
            xhrFields: {
                withCredentials: true
            },
            data: JSON.stringify(dataJson),
            timeout: 10000,
            contentType: "application/json;charset=utf-8",
            error: function (xhr, type) {
                layer.msg("服务器异常，请稍后重试！", {time: 2000})
            },
            successx: function (data) {
                if (data.success == true) {
                    $("#description_pile_concrete_description").val(data.data.descriptionPileConcreteDescription);
                    $("#bearing_layer_description").val(data.data.bearingLayerDescription);
                    $("#helpId").val(data.data.id);
                    initPileUpdate();
                } else {
                    layer.msg(data.message,{time:1000})
                }
            },
        });
    });

</script>
</body>


</html>